<?php
/**
 *
 * @author Tongle Xu <xutongle@gmail.com> 2013-9-14
 * @copyright Copyright (c) 2003-2103 tintsoft.com
 * @license http://www.tintsoft.com
 * @version $Id$
 */
abstract class Base_UrlRule {
	/**
	 *
	 * @var boolean whether this rule will also parse the host info part.
	 *      Defaults to false.
	 */
	public $hasHostInfo = false;
	/**
	 * Creates a URL based on this rule.
	 *
	 * @param Url $manager the manager
	 * @param string $route the route
	 * @param array $params list of parameters (name=>value) associated with the
	 *        route
	 * @param string $ampersand the token separating name-value pairs in the
	 *        URL.
	 * @return mixed the constructed URL. False if this rule does not apply.
	 */
	abstract public function createUrl($manager, $route, $params, $ampersand);
	/**
	 * Parses a URL based on this rule.
	 *
	 * @param Url $manager the URL manager
	 * @param HttpRequest $request the request object
	 * @param string $pathInfo path info part of the URL (URL suffix is already
	 *        removed based on {@link CUrlManager::urlSuffix})
	 * @param string $rawPathInfo path info that contains the potential URL
	 *        suffix
	 * @return mixed the route that consists of the controller ID and action ID.
	 *         False if this rule does not apply.
	 */
	abstract public function parseUrl($manager, $request, $pathInfo, $rawPathInfo);
}